<template>
  <div>
    <tr v-for="(obj, index) in obj" :key="index">
      <td><input type="checkbox" v-model="obj.checked" /></td>
      <td>{{ obj.name }}</td>
      <td>{{ obj.price }}</td>
      <td>
        <button @click="obj.num > 1 && obj.num--">-</button>
        {{ obj.num }}
        <button @click="obj.num++">+</button>
      </td>
      <td>{{ obj.price * obj.num }}</td>
      <td>
        <button @click="clearFn">删除</button>
      </td>
    </tr>
  </div>
</template>

<script>
// import EventBus from"../EventBus"
export default {
  props: ["obj"],
  data() {
    return {};
  },
  methods: {
    clearFn() {
      this.$emit("delClick");
    },
  },
};
</script>

<style scoped>
td {
  border: 1px solid #ccc;
  width: 700px;
}
</style>
